package com.example.demo.service;

import com.example.demo.mapper.UserInfoMapper;
import com.example.demo.model.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserService {
    @Autowired
    private UserInfoMapper userInfoMapper;

    @Transactional(propagation = Propagation.NESTED)
    public Integer insert(String userName, String password) {
        UserInfo userInfo=new UserInfo();
        userInfo.setUserName(userName);
        userInfo.setPassword(password);
        Integer insert = userInfoMapper.insert(userInfo);
        return insert;
    }
}
